<?php
class Context
{
	private static $_instance;
	
	private $_widgets;
	
	private function __construct()
	{
		$this->_widgets = array();
	}
	
	public static function getInstance()
	{
		if(!isset(self::$_instance))
		{
			self::$_instance = new Context();
		}
		return self::$_instance;
	}
	
	public function getWidget($path)
	{
		if(isset($this->_widgets[$path])){
			Yii::app()->controller->widget($path, $this->_widgets[$path]);
		}
	}
	
	public function addWidget($path, $params)
	{
		$this->_widgets[$path] = $params;
	}
}